Repository navigation
Pass the full WordPress coding standard and run PHPCS on pull requests - #22
Merged
Merged
Conversation
Resolve all WordPress-Core violations phpcbf couldn't fix: capitalize class names, use strict comparisons, stop passing variables to translation functions, replace date() with gmdate(), split multiple assignments, drop short ternaries, and rename reserved-keyword params. Replace phpcs-security.xml.dist with a phpcs.xml.dist that checks WordPress-Core plus WordPress.Security, and add a GitHub Action that runs it on every pull request. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Switch the ruleset to the full WordPress standard with sniff codes and colors in reports, register the custom organiser/use_do_action_tools capabilities, and install WPCS via Composer in CI. Drop underscore prefixes from members, remove a duplicate can_export key, use a capability instead of role checks, drop unused hook parameters, set explicit asset versions and footer flags, and fix Do_Action_Tools reading a nonexistent $_version property. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Loading it during init at priority 0 skipped the plugin's own priority 0 init callbacks (added in #20), so post types were never defined and 19 tests errored. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Brings the codebase to zero errors and zero warnings against the full
WordPressstandard, and adds a GitHub Action that runs PHPCS on every PR.CI
phpcs.xml.distchecks theWordPressstandard, shows sniff codes and uses colored output. It registers the customorganiseranduse_do_action_toolscapabilities and excludes the bundled third-partyakismet.fuspam.php. It replacesphpcs-security.xml.dist, which is now covered by the full standard..github/workflows/phpcs.ymlruns on PHP 8.5, installs WPCS with Composer and runsphpcs.Behavior-relevant changes (worth a look)
administratororeditorrole. It now checks theedit_others_postscapability, which both roles have in core. The existingedit_postcheck on the nonprofit still applies first.select_multi/checkbox_multi/radio/select: option keys are integer post IDs, while saved values can be ints (nonprofits) or strings (sponsors), so both sides are compared as strings.(int).false, which used the WordPress version.Bug fixes
Do_Action_Toolsread$this->_version, which doesn't exist. It now uses$this->parent->version.can_exportwas set twice in the post type args. Removed the duplicate (both weretrue).Other fixes (no behavior change)
do_action,do_action_tools, etc. becomeDo_Action,Do_Action_Tools, etc. PHP class names are case-insensitive, so nothing breaks.$_version/$_token/$_instance/_log_version_number()lose their underscore prefix (all references updated). Reserved-keyword parameters are renamed ($echo→$display,$parent→$plugin).add_action()/add_filter()arg counts updated.esc_attr_e( $var )/esc_html_e( $var )→echo esc_attr( $var )/echo esc_html( $var ). This stops running variables through translation; the output is the same._n()used non-literal strings and a placeholderyour_textdomaindomain that has no translations, so it always fell back to English. It now picks the label with1 === $published, which gives the same output.date()→gmdate(): identical, because WordPress sets PHP's default timezone to UTC.get_user_ip()helper with the same fallback order and result.$in_footeris set explicitly tofalse, which was already the behavior.return;and a commented-outif.@param/@returntags, and full stops on inline comments. This commit only changes comments; token comparison confirms the code is unchanged.phpcs:ignore/disable, each with a reason:fclose()onphp://outputTesting
phpcsreports no errors or warnings, locally and in CI.muplugins_loaded. It used to load it duringinitat priority 0, which skipped the plugin's own priority 0initcallbacks added in Fix PHP deprecation notices and early textdomain loading #20. As a result, 19 tests had been erroring ontrunksince Fix PHP deprecation notices and early textdomain loading #20. Production was unaffected, because WordPress loads plugins beforeinit.🤖 Generated with Claude Code